package com.eastfair.venueservice.enums;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * 服务订单退款状态
 *
 * @author dqq
 * @date 2023 /5/16
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum BondManageRefundStatus implements BaseEnum {

    /**
     * NO_REFUND="无须退款"
     */
    NO_REFUND("无须退款"),
    /**
     * 未申请退款
     */
    NOT_APPLIED("未申请退款"),
    /**
     * 已申请退款
     */
    APPLIED("已申请退款"),
    /**
     * REFUNDING="退款中"
     */
    AUTH("退款中"),
    /**
     * 已退款
     */
    AUTH_SUCESS("已退款"),
    /**
     * REFUND_REJECT="退款驳回"
     */
    AUTH_FAIL("被驳回"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     *
     * @param val the val
     * @param def the def
     * @return the service order refund status
     */
    public static BondManageRefundStatus match(String val, BondManageRefundStatus def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    /**
     * Get service order refund status.
     *
     * @param val the val
     * @return the service order refund status
     */
    public static BondManageRefundStatus get(String val) {
        return match(val, null);
    }

    /**
     * Eq boolean.
     *
     * @param val the val
     * @return the boolean
     */
    public boolean eq(BondManageRefundStatus val) {
        return val != null && eq(val.name());
    }

    @Override
    public String getCode() {
        return this.name();
    }

    @Override
    public String getDesc() {
        return null;
    }

}